app.service("userService", function ($window) {
    return {
        setData: function (data) {
            if (data) {
                var sStorage = $window.sessionStorage;
                sStorage.setItem('UserId', data.id);
                sStorage.setItem('UserName', data.name);
                sStorage.setItem('RoleId', data.roleId);
                sStorage.setItem('ClientId', data.clientId);
                sStorage.setItem('TypeId', data.typeId);
            }
        },
        getId: function () {
            return $window.sessionStorage.getItem('UserId');
        },
        getName: function () {
            return $window.sessionStorage.getItem('UserName');
        },
        getRoleId: function () {
            return $window.sessionStorage.getItem('RoleId');
        },
        getClientId: function () {
            return $window.sessionStorage.getItem('ClientId');
        },
        setAppId: function (id) {
            $window.sessionStorage.setItem('AppId', id);
        },
        getAppId: function () {
            return $window.sessionStorage.getItem('AppId');
        },
        IsAdmin:function () {
            return $window.sessionStorage.getItem('TypeId') == 9;
        }
    };
});